package com.woniu.order.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;

/**
 * 
 * @TableName invoice
 */
@TableName(value ="invoice")
@Data
public class Invoice implements Serializable {
    /**
     * 开票Id
     */
    private String id;

    /**
     * 购买方id
     */
    private String buyerId;

    /**
     * 地址id
     */
    private String addressId;

    /**
     * 开票人
     */
    private String drawer;

    /**
     * 合计金额。保留两位小数，支持价税分离
     */
    private BigDecimal invoiceTotalPrice;

    /**
     * 订单id
     */
    private String orderId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Invoice other = (Invoice) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getBuyerId() == null ? other.getBuyerId() == null : this.getBuyerId().equals(other.getBuyerId()))
            && (this.getAddressId() == null ? other.getAddressId() == null : this.getAddressId().equals(other.getAddressId()))
            && (this.getDrawer() == null ? other.getDrawer() == null : this.getDrawer().equals(other.getDrawer()))
            && (this.getInvoiceTotalPrice() == null ? other.getInvoiceTotalPrice() == null : this.getInvoiceTotalPrice().equals(other.getInvoiceTotalPrice()))
            && (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getBuyerId() == null) ? 0 : getBuyerId().hashCode());
        result = prime * result + ((getAddressId() == null) ? 0 : getAddressId().hashCode());
        result = prime * result + ((getDrawer() == null) ? 0 : getDrawer().hashCode());
        result = prime * result + ((getInvoiceTotalPrice() == null) ? 0 : getInvoiceTotalPrice().hashCode());
        result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", buyerId=").append(buyerId);
        sb.append(", addressId=").append(addressId);
        sb.append(", drawer=").append(drawer);
        sb.append(", invoiceTotalPrice=").append(invoiceTotalPrice);
        sb.append(", orderId=").append(orderId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}